home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 92 / CDMM92_1.ISO / SOF 2 SDK / sof2sdk-101.msi / _92D6AC311BB48EBA344BBABC89DA6AB0 / _5E123CFAFA1645DD9E3480D874C073CF < prev    next >
Encoding:
Text File  |  2002-07-01  |  43.3 KB  |  1,165 lines

  1. // Copyright (C) 2001-2002 Raven Software.
  2. //
  3. // g_local.h -- local definitions for game module
  4.  
  5. #include "q_shared.h"
  6. #include "bg_public.h"
  7. #include "g_public.h"
  8. #include "../gametype/gt_public.h"
  9. #include "../ghoul2/g2.h"
  10.  
  11. //==================================================================
  12.  
  13. // the "gameversion" client command will print this plus compile date
  14. #define    GAMEVERSION    "sof2mp"
  15.  
  16. #define BODY_QUEUE_SIZE_MAX            MAX_CLIENTS
  17. #define BODY_QUEUE_SIZE                8
  18.  
  19. #define INFINITE                    1000000
  20. #define Q3_INFINITE                    16777216 
  21.  
  22. #define    FRAMETIME                    100                    // msec
  23.  
  24. #define    INTERMISSION_DELAY_TIME        3000
  25.  
  26. // gentity->flags
  27. #define    FL_GODMODE                    0x00000010
  28. #define    FL_NOTARGET                    0x00000020
  29. #define    FL_TEAMSLAVE                0x00000400    // not the first on the team
  30. #define FL_NO_KNOCKBACK                0x00000800
  31. #define FL_DROPPED_ITEM                0x00001000
  32. #define FL_NO_BOTS                    0x00002000    // spawn point not for bot use
  33. #define FL_NO_HUMANS                0x00004000    // spawn point just for bots
  34.  
  35. #define    MAX_SPAWNS                    128
  36.  
  37. // movers are things like doors, plats, buttons, etc
  38. typedef enum 
  39. {
  40.     MOVER_POS1,
  41.     MOVER_POS2,
  42.     MOVER_1TO2,
  43.     MOVER_2TO1
  44.  
  45. } moverState_t;
  46.  
  47. typedef struct gentity_s gentity_t;
  48. typedef struct gclient_s gclient_t;
  49.  
  50. struct gentity_s 
  51. {
  52.     entityState_t    s;                // communicated by server to clients
  53.     entityShared_t    r;                // shared by both the server system and game
  54.  
  55.     // DO NOT MODIFY ANYTHING ABOVE THIS, THE SERVER
  56.     // EXPECTS THE FIELDS IN THAT ORDER!
  57.     //================================
  58.  
  59.     struct gclient_s    *client;            // NULL if not a client
  60.  
  61.     qboolean    inuse;
  62.  
  63.     char        *classname;            // set in QuakeEd
  64.     int            spawnflags;            // set in QuakeEd
  65.  
  66.     qboolean    neverFree;            // if true, FreeEntity will only unlink
  67.                                     // bodyque uses this
  68.  
  69.     int            flags;                // FL_* variables
  70.  
  71.     char        *model;
  72.     char        *model2;
  73.     int            freetime;            // level.time when the object was freed
  74.     
  75.     int            eventTime;            // events will be cleared EVENT_VALID_MSEC after set
  76.     qboolean    freeAfterEvent;
  77.     qboolean    unlinkAfterEvent;
  78.  
  79.     qboolean    physicsObject;        // if true, it can be pushed by movers and fall off edges
  80.                                     // all game items are physicsObjects, 
  81.     float        physicsBounce;        // 1.0 = continuous bounce, 0.0 = no bounce
  82.     int            clipmask;            // brushes with this content value will be collided against
  83.                                     // when moving.  items and corpses do not collide against
  84.                                     // players, for instance
  85.  
  86.     // movers
  87.     moverState_t moverState;
  88.     int            soundPos1;
  89.     int            sound1to2;
  90.     int            sound2to1;
  91.     int            soundPos2;
  92.     int            soundLoop;
  93.     gentity_t    *parent;
  94.     gentity_t    *nextTrain;
  95.     vec3_t        pos1, pos2;
  96.  
  97.     char        *message;
  98.  
  99.     int            timestamp;        // body queue sinking, etc
  100.  
  101.     float        angle;            // set in editor, -1 = up, -2 = down
  102.     char        *target;
  103.     char        *targetname;
  104.     char        *team;
  105.     char        *targetShaderName;
  106.     char        *targetShaderNewName;
  107.     gentity_t    *target_ent;
  108.  
  109.     float        speed;
  110.     vec3_t        movedir;
  111.     float        mass;
  112.     int            setTime;
  113.  
  114. //Think Functions
  115.     int            nextthink;
  116.     void        (*think)(gentity_t *self);
  117.     void        (*reached)(gentity_t *self);    // movers call this when hitting endpoint
  118.     void        (*blocked)(gentity_t *self, gentity_t *other);
  119.     void        (*touch)(gentity_t *self, gentity_t *other, trace_t *trace);
  120.     void        (*use)(gentity_t *self, gentity_t *other, gentity_t *activator);
  121.     void        (*pain)(gentity_t *self, gentity_t *attacker, int damage);
  122.     void        (*die)(gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod, int hitLocation, vec3_t hitDir );
  123.  
  124.     int            pain_debounce_time;
  125.     int            fly_sound_debounce_time;    // wind tunnel
  126.     int            last_move_time;
  127.  
  128. //Health and damage fields
  129.     int            health;
  130.     qboolean    takedamage;
  131.  
  132.     int            damage;
  133.     int            dflags;
  134.     int            splashDamage;    // quad will increase this without increasing radius
  135.     int            splashRadius;
  136.     int            methodOfDeath;
  137.     int            splashMethodOfDeath;
  138.  
  139.     int            count;
  140.     float        bounceScale;
  141.  
  142.     gentity_t    *chain;
  143.     gentity_t    *enemy;
  144.     gentity_t    *activator;
  145.     gentity_t    *teamchain;        // next entity in team
  146.     gentity_t    *teammaster;    // master of the team
  147.  
  148.     int            watertype;
  149.     int            waterlevel;
  150.  
  151.     int            noise_index;
  152.  
  153.     // timing variables
  154.     float        wait;
  155.     float        random;
  156.     int            delay;
  157.  
  158.     gitem_t        *item;            // for bonus items
  159. };
  160.  
  161. typedef struct gspawn_s
  162. {
  163.     team_t        team;
  164.     vec3_t        origin;
  165.     vec3_t        angles;
  166.  
  167. } gspawn_t;
  168.  
  169. typedef struct gtitem_s
  170. {
  171.     int        id;
  172.     int        useIcon;
  173.     int        useSound;
  174.     int        useTime;
  175.  
  176. } gtitem_t;
  177.  
  178. typedef enum 
  179. {
  180.     CON_DISCONNECTED,
  181.     CON_CONNECTING,
  182.     CON_CONNECTED
  183.  
  184. } clientConnected_t;
  185.  
  186. typedef enum 
  187. {
  188.     SPECTATOR_NOT,
  189.     SPECTATOR_FREE,
  190.     SPECTATOR_FOLLOW,
  191.     SPECTATOR_SCOREBOARD
  192.  
  193. } spectatorState_t;
  194.  
  195. typedef enum 
  196. {
  197.     TEAM_BEGIN,        // Beginning a team game, spawn at base
  198.     TEAM_ACTIVE        // Now actively playing
  199.  
  200. } playerTeamStateState_t;
  201.  
  202. typedef struct 
  203. {
  204.     playerTeamStateState_t    state;
  205.  
  206.     int            location;
  207.  
  208.     int            captures;
  209.     int            basedefense;
  210.     int            carrierdefense;
  211.     int            flagrecovery;
  212.     int            fragcarrier;
  213.     int            assists;
  214.  
  215.     float        lasthurtcarrier;
  216.     float        lastreturnedflag;
  217.     float        flagsince;
  218.     float        lastfraggedcarrier;
  219.  
  220. } playerTeamState_t;
  221.  
  222. // the auto following clients don't follow a specific client
  223. // number, but instead follow the first two active players
  224. #define    FOLLOW_ACTIVE1    -1
  225. #define    FOLLOW_ACTIVE2    -2
  226.  
  227. // client data that stays across multiple levels or map restarts
  228. // this is achieved by writing all the data to cvar strings at game shutdown
  229. // time and reading them back at connection time.  Anything added here
  230. // MUST be dealt with in G_InitSessionData() / G_ReadSessionData() / G_WriteSessionData()
  231. typedef struct 
  232. {
  233.     team_t                team;                    // current team
  234.     int                    spectatorTime;            // for determining next-in-line to play
  235.     spectatorState_t    spectatorState;            
  236.     int                    spectatorClient;        // for chasecam and follow mode
  237.     int                    score;                    // total score
  238.     int                    kills;                    // number of kills
  239.     int                    deaths;                    // number of deaths
  240.     qboolean            ghost;                    // Whether or not the player is a ghost (sticks past team change)
  241.     int                    teamkillDamage;            // amount of damage death to teammates
  242.     int                    teamkillForgiveTime;    // time when team damage will be forgivin
  243.     qboolean            noTeamChange;            // cant change teams when this is true (rt_none only)
  244.  
  245. } clientSession_t;
  246.  
  247. //
  248. #define MAX_NETNAME            36
  249. #define MAX_IDENTITY        64
  250. #define    MAX_VOTE_COUNT        3
  251.  
  252. // client data that stays across multiple respawns, but is cleared
  253. // on each level change or team change at ClientBegin()
  254. typedef struct 
  255. {
  256.     clientConnected_t    connected;    
  257.     usercmd_t            cmd;                        // we would lose angles if not persistant
  258.     qboolean            localClient;                // true if "ip" info key is "localhost"
  259.     qboolean            initialSpawn;                // the first spawn should be at a cool location
  260.     qboolean            predictItemPickup;            // based on cg_predictItems userinfo
  261.     qboolean            pmoveFixed;                    //
  262.     qboolean            antiLag;                    // anti-lag on or off
  263.     qboolean            autoReload;                    // auto rellaod turned on or off
  264.     char                netname[MAX_NETNAME];
  265.     char                deferredname[MAX_NETNAME];
  266.     int                    netnameTime;                // Last time the name was changed
  267.     TIdentity*            identity;                    // Current identity
  268.     goutfitting_t        outfitting;                    // Current outfitting
  269.     int                    enterTime;                    // level.time the client entered the game
  270.     playerTeamState_t    teamState;                    // status in teamplay games
  271.     int                    voteCount;                    // to prevent people from constantly calling votes
  272.     int                    firemode[MAX_WEAPONS];        // weapon firemodes
  273.  
  274. } clientPersistant_t;
  275.  
  276. #define MAX_SERVER_FPS        40
  277. #define MAX_ANTILAG            MAX_SERVER_FPS
  278.  
  279. // Antilag information
  280. typedef struct gantilag_s
  281. {
  282.     vec3_t    rOrigin;                // entity.r.currentOrigin
  283.     vec3_t    rAngles;                // entity.r.currentAngles
  284.     vec3_t    mins;                    // entity.r.mins
  285.     vec3_t    maxs;                    // entity.r.maxs
  286.  
  287.     vec3_t    legsAngles;                // entity.client.ghoulLegsAngles
  288.     vec3_t    lowerTorsoAngles;        // entity.client.ghoulLowerTorsoAngles
  289.     vec3_t    upperTorsoAngles;        // entity.client.ghoulUpperTorsoAngles
  290.     vec3_t    headAngles;                // entity.client.ghoulHeadAngles
  291.  
  292.     int        time;                    // time history item was saved
  293.     int        leveltime;
  294.  
  295.     int        torsoAnim;                // entity.client.ps.torsoAnim
  296.     int        legsAnim;                // entity.client.ps.legsAnim
  297.  
  298.     float    leanTime;                // entity.client.ps.leanOffset
  299.     int        pm_flags;                // entity.client.ps.pm_flags
  300.  
  301. } gantilag_t;
  302.  
  303. // this structure is cleared on each ClientSpawn(),
  304. // except for 'client->pers' and 'client->sess'
  305. struct gclient_s 
  306. {
  307.     // ps MUST be the first element, because the server expects it
  308.     playerState_t    ps;                // communicated by server to clients
  309.  
  310.     // the rest of the structure is private to game
  311.     clientPersistant_t    pers;
  312.     clientSession_t        sess;
  313.  
  314.     qboolean    readyToExit;        // wishes to leave the intermission
  315.  
  316.     qboolean    noclip;
  317.  
  318.     int            lastCmdTime;        // level.time of last usercmd_t, for EF_CONNECTION
  319.                                     // we can't just use pers.lastCommand.time, because
  320.                                     // of the g_sycronousclients case
  321.     int            buttons;
  322.     int            oldbuttons;
  323.     int            latched_buttons;
  324.  
  325.     vec3_t        oldOrigin;
  326.  
  327.     // sum up damage over an entire frame, so
  328.     // shotgun blasts give a single big kick
  329.     int            damage_armor;        // damage absorbed by armor
  330.     int            damage_blood;        // damage taken out of health
  331.     int            damage_knockback;    // impact damage
  332.     vec3_t        damage_from;        // origin for vector calculation
  333.     qboolean    damage_fromWorld;    // if true, don't use the damage_from vector
  334.     
  335.     int            accurateCount;        // for "impressive" reward sound
  336.  
  337.     //
  338.     int            lastkilled_client;    // last client that this client killed
  339.     int            lasthurt_client;    // last client that damaged this client
  340.     int            lasthurt_time;        // time this client was last hurt
  341.     int            lasthurt_mod;        // type of damage the client did
  342.  
  343.     // timers
  344.     int            respawnTime;        // can respawn when time > this, force after g_forcerespwan
  345.     int            invulnerableTime;    // invulnerable time
  346.     int            inactivityTime;        // kick players when time > this
  347.     qboolean    inactivityWarning;    // qtrue if the five seoond warning has been given
  348.     int            rewardTime;            // clear the EF_AWARD_IMPRESSIVE, etc when time > this
  349.  
  350.     int            airOutTime;
  351.  
  352.     int            lastKillTime;        // for multiple kill rewards
  353.  
  354.     qboolean    fireHeld;            // used for hook
  355.     gentity_t    *hook;                // grapple hook if out
  356.  
  357.     int            switchTeamTime;        // time the player switched teams
  358.     int            voteDelayTime;        // time when this client can vote again
  359.  
  360.     char        *areabits;
  361.  
  362.     int                voiceFloodTimer;        // Timer used to forgive voice chat flooding
  363.     int                voiceFloodCount;        // Amount of voice chats that need to be forgivin
  364.     int                voiceFloodPenalty;        // Time when a client can voice chat again
  365.  
  366.     // Anti-lag information
  367.     gantilag_t        antilag[MAX_ANTILAG];
  368.     gantilag_t        antilagUndo;
  369.     int                antilagHead;
  370.  
  371.     qboolean        noOutfittingChange;
  372.  
  373.     animInfo_t        torso;
  374.     animInfo_t        legs;
  375.     vec3_t            ghoulLegsAngles;
  376.     vec3_t            ghoulLowerTorsoAngles;
  377.     vec3_t            ghoulUpperTorsoAngles;
  378.     vec3_t            ghoulHeadAngles;
  379.  
  380.     gentity_t        *siameseTwin;
  381.     gentity_t        *useEntity;
  382.  
  383.     vec3_t            maxSave;
  384.     vec3_t            minSave;
  385. };
  386.  
  387.  
  388. //
  389. // this structure is cleared as each map is entered
  390. //
  391. #define    MAX_SPAWN_VARS            64
  392. #define    MAX_SPAWN_VARS_CHARS    4096
  393.  
  394. #define    MAX_AUTOKICKLIST        32
  395.  
  396. typedef struct 
  397. {
  398.     struct gclient_s    *clients;        // [maxclients]
  399.  
  400.     struct gentity_s    *gentities;
  401.  
  402.     int                gentitySize;
  403.     int                num_entities;        // current number, <= MAX_GENTITIES
  404.  
  405.     int                warmupTime;            // restart match at this time
  406.  
  407.     int                gametype;            // Current gametype index (gametypeData[gametype])
  408.     gametypeData_t*    gametypeData;        // Current gametype data for easier access
  409.  
  410.     vec3_t            worldMins;            // Absolute min coords of the world
  411.     vec3_t            worldMaxs;            // Absolute max coords of the world
  412.  
  413.     fileHandle_t    logFile;
  414.  
  415.     // store latched cvars here that we want to get at often
  416.     int            maxclients;
  417.  
  418.     int            framenum;
  419.     int            time;                    // in msec
  420.     int            previousTime;            // so movers can back up when blocked
  421.     int            frameStartTime;            
  422.  
  423.     int            startTime;                // level.time the map was started
  424.     int            globalVoiceTime;        // last global voice
  425.  
  426.     int            teamScores[TEAM_NUM_TEAMS];
  427.     int            lastTeamLocationTime;        // last time of client team location update
  428.  
  429.     qboolean    newSession;                // don't use any old session data, because
  430.                                         // we changed gametype
  431.  
  432.     qboolean    restarted;                // waiting for a map_restart to fire
  433.  
  434.     int            numConnectedClients;
  435.     int            numNonSpectatorClients;    // includes connecting clients
  436.     int            numPlayingClients;        // connected, non-spectators
  437.     int            sortedClients[MAX_CLIENTS];        // sorted by score
  438.     int            follow1, follow2;        // clientNums for auto-follow spectators
  439.  
  440.     int            warmupModificationCount;    // for detecting if g_warmup is changed
  441.  
  442.     // voting state
  443.     char        voteString[MAX_STRING_CHARS];
  444.     char        voteDisplayString[MAX_STRING_CHARS];
  445.     int            voteTime;                // level.time vote was called
  446.     int            voteExecuteTime;        // time the vote is executed
  447.     int            voteYes;
  448.     int            voteNo;
  449.     int            voteClient;                // client who initiated vote
  450.     int            numVotingClients;        // set by CalculateRanks
  451.  
  452.     // spawn variables
  453.     qboolean    spawning;                // the G_Spawn*() functions are valid
  454.     int            numSpawnVars;
  455.     char        *spawnVars[MAX_SPAWN_VARS][2];    // key / value pairs
  456.     int            numSpawnVarChars;
  457.     char        spawnVarChars[MAX_SPAWN_VARS_CHARS];
  458.  
  459.     // intermission state
  460.     int            intermissionQueued;        // intermission was qualified, but
  461.                                         // wait INTERMISSION_DELAY_TIME before
  462.                                         // actually going there so the last
  463.                                         // frag can be watched.  Disable future
  464.                                         // kills during this delay
  465.     int            intermissiontime;        // time the intermission was started
  466.     char        *changemap;
  467.     qboolean    readyToExit;            // at least one client wants to exit
  468.     int            exitTime;
  469.     vec3_t        intermission_origin;    // also used for spectator spawns
  470.     vec3_t        intermission_angle;
  471.  
  472.     qboolean    locationLinked;            // target_locations get linked
  473.     gentity_t    *locationHead;            // head of the location list
  474.  
  475.     // body queue
  476.     int            bodyQueIndex;            // dead bodies
  477.     int            bodyQueSize;            // how many dead bodies can there be
  478.     int            bodySinkTime;
  479.     gentity_t    *bodyQue[BODY_QUEUE_SIZE_MAX];
  480.  
  481.     int            portalSequence;
  482.  
  483.     int            mNumBSPInstances;
  484.     int            mBSPInstanceDepth;
  485.     vec3_t        mOriginAdjust;
  486.     float        mRotationAdjust;
  487.     char        *mTargetAdjust;
  488.     qboolean    hasBspInstances;
  489.     char        mFilter[MAX_QPATH];
  490.     char        mTeamFilter[MAX_QPATH];
  491.  
  492.     struct gentity_s    *landScapes[MAX_TERRAINS];
  493.  
  494.     int                gametypeStartTime;
  495.     int                gametypeJoinTime;
  496.     int                gametypeResetTime;
  497.     int                gametypeRoundTime;
  498.     int                gametypeRespawnTime[TEAM_NUM_TEAMS];
  499.     int                gametypeDelayTime;
  500.     const char*        gametypeTeam[TEAM_NUM_TEAMS];
  501.     gtitem_t        gametypeItems[MAX_GAMETYPE_ITEMS];
  502.  
  503.     void*            serverGhoul2;
  504.     animation_t        ghoulAnimations[MAX_ANIMATIONS];
  505.  
  506.     int                ladderCount;
  507.  
  508.     gspawn_t        spawns[MAX_SPAWNS];
  509.     int                spawnCount;
  510.  
  511.     qboolean        pickupsDisabled;
  512.  
  513.     int                timeExtension;
  514.  
  515.     int                autokickedCount;
  516.     int                autokickedHead;
  517.     char            autokickedName[MAX_AUTOKICKLIST][MAX_NETNAME];
  518.     char            autokickedIP[MAX_AUTOKICKLIST][20];
  519.  
  520. } level_locals_t;
  521.  
  522. //
  523. // g_spawn.c
  524. //
  525. qboolean    G_SpawnString( const char *key, const char *defaultString, char **out );
  526. // spawn string returns a temporary reference, you must CopyString() if you want to keep it
  527. qboolean    G_SpawnFloat( const char *key, const char *defaultString, float *out );
  528. qboolean    G_SpawnInt( const char *key, const char *defaultString, int *out );
  529. qboolean    G_SpawnVector( const char *key, const char *defaultString, float *out );
  530. qboolean    G_ParseSpawnVars( qboolean inSubBSP );
  531. void        G_SpawnGEntityFromSpawnVars( qboolean inSubBSP );
  532. void        G_SpawnEntitiesFromString( qboolean inSubBSP );
  533. char        *G_NewString( const char *string );
  534. void        AddSpawnField(char *field, char *value);
  535.  
  536. //
  537. // g_cmds.c
  538. //
  539. void        Cmd_Score_f            ( gentity_t *ent );
  540. void        G_StopFollowing        ( gentity_t *ent );
  541. void        G_StopGhosting        ( gentity_t* ent );
  542. void        G_StartGhosting        ( gentity_t* ent );
  543.  
  544. void        BroadcastTeamChange( gclient_t *client, int oldTeam );
  545. void        SetTeam( gentity_t *ent, char *s, const char* identity );
  546. void        Cmd_FollowCycle_f( gentity_t *ent, int dir );
  547. qboolean    CheatsOk                ( gentity_t *ent );
  548. void        G_SpawnDebugCylinder    ( vec3_t origin, float radius, gentity_t* clientent, float viewRadius, int colorIndex );
  549. void        G_Voice                    ( gentity_t *ent, gentity_t *target, int mode, const char *id, qboolean voiceonly );
  550. void        G_VoiceGlobal            ( gentity_t* ent, const char* id, qboolean force );
  551. qboolean    G_CanVoiceGlobal        ( void );
  552.  
  553. //
  554. // g_items.c
  555. //
  556. void ItemUse_Shield(gentity_t *ent);
  557. void ItemUse_Sentry(gentity_t *ent);
  558. void ItemUse_Seeker(gentity_t *ent);
  559. void ItemUse_MedPack(gentity_t *ent);
  560.  
  561. void G_RunItem( gentity_t *ent );
  562. void RespawnItem( gentity_t *ent );
  563.  
  564. void        PrecacheItem        ( gitem_t *it );
  565. gentity_t*    G_DropItem            ( gentity_t *ent, gitem_t *item, float angle );
  566. gentity_t*    LaunchItem            ( gitem_t *item, vec3_t origin, vec3_t velocity );
  567. gentity_t*    G_DropWeapon        ( gentity_t* ent, weapon_t weapon, int pickupDelay );
  568.  
  569. void SetRespawn (gentity_t *ent, float delay);
  570. void G_SpawnItem (gentity_t *ent, gitem_t *item);
  571. void FinishSpawningItem( gentity_t *ent );
  572. void Think_Weapon (gentity_t *ent);
  573. int ArmorIndex (gentity_t *ent);
  574. void    Add_Ammo (gentity_t *ent, int weapon, int count);
  575. void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace);
  576.  
  577. void ClearRegisteredItems( void );
  578. void RegisterItem( gitem_t *item );
  579. void SaveRegisteredItems( void );
  580.  
  581. //
  582. // g_utils.c
  583. //
  584. int        G_ModelIndex        ( char *name );
  585. int        G_SoundIndex        ( char *name );
  586. int        G_AmbientSoundSetIndex( char *name ); 
  587. int        G_BSPIndex            ( char *name );
  588. int        G_IconIndex            ( char *name );
  589. int        G_EffectIndex        ( char *name );
  590.  
  591. void    G_TeamCommand( team_t team, char *cmd );
  592. void    G_KillBox (gentity_t *ent);
  593. gentity_t *G_Find (gentity_t *from, int fieldofs, const char *match);
  594. int        G_RadiusList ( vec3_t origin, float radius,    gentity_t *ignore, qboolean takeDamage, gentity_t *ent_list[MAX_GENTITIES]);
  595. gentity_t *G_PickTarget (char *targetname);
  596. void    G_UseTargets (gentity_t *ent, gentity_t *activator);
  597. void    G_UseTargetsByName( const char* name, gentity_t *exclude, gentity_t *activator );
  598. void    G_SetMovedir ( vec3_t angles, vec3_t movedir);
  599. void    G_SetAngles( gentity_t *ent, vec3_t angles );
  600.  
  601. void    G_InitGentity( gentity_t *e );
  602. gentity_t    *G_Spawn (void);
  603. gentity_t *G_TempEntity( vec3_t origin, int event );
  604. void    G_PlayEffect(int fxID, vec3_t org, vec3_t ang);
  605. void    G_SetHUDIcon ( int index, int icon );
  606. void    G_Sound( gentity_t *ent, int channel, int soundIndex );
  607. void    G_SoundAtLoc( vec3_t loc, int channel, int soundIndex );
  608. void    G_EntitySound( gentity_t *ent, int channel, int soundIndex );
  609. void    G_FreeEntity( gentity_t *e );
  610. qboolean    G_EntitiesFree( void );
  611.  
  612. void    G_TouchTriggers (gentity_t *ent);
  613. void    G_TouchSolids (gentity_t *ent);
  614.  
  615. //
  616. // g_object.c
  617. //
  618.  
  619. extern void G_RunObject            ( gentity_t *ent );
  620.  
  621.  
  622. float    *tv (float x, float y, float z);
  623. char    *vtos( const vec3_t v );
  624.  
  625. float vectoyaw( const vec3_t vec );
  626.  
  627. void G_AddPredictableEvent( gentity_t *ent, int event, int eventParm );
  628. void G_AddEvent( gentity_t *ent, int event, int eventParm );
  629. void G_SetOrigin( gentity_t *ent, vec3_t origin );
  630. void AddRemap(const char *oldShader, const char *newShader, float timeOffset);
  631. const char *BuildShaderStateConfig(void);
  632.  
  633. // CG specific API access
  634.  
  635. void        trap_G2API_CleanGhoul2Models    ( void **ghoul2Ptr );
  636. void        trap_G2API_CollisionDetect        ( CollisionRecord_t *collRecMap, void* ghoul2, const vec3_t angles, const vec3_t position,int frameNumber, int entNum, vec3_t rayStart, vec3_t rayEnd, vec3_t scale, int traceFlags, int useLod );
  637. qhandle_t    trap_G2API_RegisterSkin            ( const char *skinName, int numPairs, const char *skinPairs);
  638. qboolean    trap_G2API_SetSkin                ( void* ghoul2, int modelIndex, qhandle_t customSkin);
  639. qboolean    trap_G2API_GetAnimFileNameIndex ( void* ghoul2, qhandle_t modelIndex, const char* name );
  640.  
  641. void        trap_G2_ListModelSurfaces(void *ghlInfo);
  642. void        trap_G2_ListModelBones(void *ghlInfo, int frame);
  643. int            trap_G2API_AddBolt(void *ghoul2, const int modelIndex, const char *boneName);
  644. void        trap_G2API_SetBoltInfo(void *ghoul2, int modelIndex, int boltInfo);
  645. qboolean    trap_G2API_RemoveBolt(void *ghlInfo, const int modelIndex, const int index);
  646. qboolean    trap_G2API_AttachG2Model(void *ghoul2From, int modelFrom, void *ghoul2To, int toBoltIndex, int toModel);
  647. void        trap_G2_SetGhoul2ModelIndexes(void *ghoul2, qhandle_t *modelList, qhandle_t *skinList);
  648. qboolean    trap_G2_HaveWeGhoul2Models(void *ghoul2);
  649. qboolean    trap_G2API_GetBoltMatrix(void *ghoul2, const int modelIndex, const int boltIndex, mdxaBone_t *matrix,
  650.                                 const vec3_t angles, const vec3_t position, const int frameNum, qhandle_t *modelList, vec3_t scale);
  651. int            trap_G2API_InitGhoul2Model(void **ghoul2Ptr, const char *fileName, int modelIndex, qhandle_t customSkin,
  652.                           qhandle_t customShader, int modelFlags, int lodBias);
  653.  
  654. int            trap_G2API_CopyGhoul2Instance(void *g2From, void *g2To, int modelIndex);
  655. int            trap_G2API_CopySpecificGhoul2Model(void *g2From, int modelFrom, void *g2To, int modelTo);
  656. void        trap_G2API_DuplicateGhoul2Instance(void *g2From, void **g2To);
  657. qboolean    trap_G2API_RemoveGhoul2Model(void **ghlInfo, int modelIndex);
  658.  
  659. qboolean    trap_G2API_SetBoneAngles(void *ghoul2, int modelIndex, const char *boneName, const vec3_t angles, const int flags,
  660.                                 const int up, const int right, const int forward, qhandle_t *modelList,
  661.                                 int blendTime , int currentTime );
  662. char        *trap_G2API_GetGLAName(void *ghoul2, int modelIndex);
  663. qboolean    trap_G2API_SetBoneAnim(void *ghoul2, const int modelIndex, const char *boneName, const int startFrame, const int endFrame,
  664.                               const int flags, const float animSpeed, const int currentTime, const float setFrame , const int blendTime );
  665.  
  666.  
  667. //
  668. // g_combat.c
  669. //
  670. qboolean    CanDamage            ( gentity_t *targ, vec3_t origin);
  671. int            G_GetHitLocation    ( gentity_t *target, vec3_t ppoint, vec3_t dir );
  672. int            G_Damage            ( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_t dir, vec3_t point, int damage, int dflags, int mod, int location );
  673. qboolean    G_RadiusDamage        ( vec3_t origin, gentity_t *attacker, float damage, float radius, gentity_t *ignore, int power, int dflags, int mod );
  674. void        body_die            ( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath, int hitLocation, vec3_t hitDir );
  675. void        TossClientItems        ( gentity_t *self );
  676.  
  677. // damage flags
  678. #define DAMAGE_RADIUS                0x00000001    // damage was indirect
  679. #define DAMAGE_NO_ARMOR                0x00000002    // armour does not protect from this damage
  680. #define DAMAGE_NO_KNOCKBACK            0x00000004    // do not affect velocity, just view angles
  681. #define DAMAGE_NO_PROTECTION        0x00000008  // armor, shields, invulnerability, and godmode have no effect
  682. #define DAMAGE_NO_TEAM_PROTECTION    0x00000010  // armor, shields, invulnerability, and godmode have no effect
  683. #define DAMAGE_DEATH_KNOCKBACK        0x00000080    // only does knockback on death of target
  684. #define DAMAGE_AREA_DAMAGE            0x00000400    // spawn area damage
  685. #define DAMAGE_NO_GORE                0x00000800    // dont spawn gore pieces with this damage
  686. #define    DAMAGE_FORCE_GORE            0x00001000    // force something to pop off
  687. #define DAMAGE_NO_TEAMKILL            0x00002000    // does not produce teamkill damage
  688.  
  689. //
  690. // g_missile.c
  691. //
  692. void        G_RunMissile        ( gentity_t *ent );
  693. gentity_t*    G_CreateMissile        ( vec3_t org, vec3_t dir, float vel, int life, gentity_t *owner, attackType_t attack );
  694. gentity_t*    G_CreateDamageArea    ( vec3_t origin, gentity_t* attacker, float damage, float radius, int duration, int mod );
  695. void        G_BounceProjectile    ( vec3_t start, vec3_t impact, vec3_t dir, vec3_t endout );
  696. void        G_ExplodeMissile    ( gentity_t *ent );
  697. void        G_GrenadeThink        ( gentity_t* ent );
  698.  
  699. //
  700. // g_mover.c
  701. //
  702. void        G_RunMover            ( gentity_t *ent );
  703. void        Touch_DoorTrigger    ( gentity_t *ent, gentity_t *other, trace_t *trace );
  704. void        G_ResetGlass        ( void );
  705.  
  706.  
  707. //
  708. // g_trigger.c
  709. //
  710. void        trigger_teleporter_touch        ( gentity_t *self, gentity_t *other, trace_t *trace );
  711. void        InitTrigger                        ( gentity_t *self );
  712.  
  713. //
  714. // g_misc.c
  715. //
  716. void        TeleportPlayer                    ( gentity_t *player, vec3_t origin, vec3_t angles );
  717.  
  718.  
  719. //
  720. // g_weapon.c
  721. //
  722. void        SnapVectorTowards                ( vec3_t v, vec3_t to );
  723. void        G_InitHitModels                    ( void );
  724.  
  725. //
  726. // g_client.c
  727. //
  728. qboolean    G_IsClientSpectating            ( gclient_t* client );
  729. qboolean    G_IsClientDead                    ( gclient_t* client );
  730. void        G_ClientCleanName                ( const char *in, char *out, int outSize, qboolean colors );
  731. int            TeamCount                        ( int ignoreClientNum, team_t team, int* alive );
  732. int            G_GhostCount                    ( team_t team );
  733. team_t        PickTeam                        ( int ignoreClientNum );
  734. void        SetClientViewAngle                ( gentity_t *ent, vec3_t angle );
  735. void        CopyToBodyQue                    ( gentity_t *ent, int hitLocation, vec3_t hitDirection );
  736. void        respawn                            ( gentity_t *ent);
  737. void        BeginIntermission                ( void);
  738. void        InitClientPersistant            ( gclient_t *client);
  739. void        InitClientResp                    ( gclient_t *client);
  740. void        ClientSpawn                        ( gentity_t *ent );
  741. void        player_die                        ( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod, int hitLocation, vec3_t hitDir );
  742. void        G_InitBodyQueue                    ( void);
  743. void        G_AddScore                        ( gentity_t *ent, int score );
  744. void        CalculateRanks                    ( void );
  745. qboolean    G_SpotWouldTelefrag                ( gspawn_t* spawn );
  746. void        G_UpdateClientAnimations        ( gentity_t* ent );
  747. void        G_SetRespawnTimer                ( gentity_t* ent );
  748. gentity_t*    G_FindNearbyClient                ( vec3_t origin, team_t team, float radius, gentity_t* ignore );
  749. void        G_AddClientSpawn                ( gentity_t* ent, team_t team );
  750.  
  751. //
  752. // g_svcmds.c
  753. //
  754. qboolean    ConsoleCommand                    ( void );
  755.  
  756. //
  757. // g_weapon.c
  758. //
  759. gentity_t*    G_FireWeapon                    ( gentity_t *ent, attackType_t attack );
  760. gentity_t*    G_FireProjectile                ( gentity_t *ent, weapon_t weapon, attackType_t attack, int projectileLifetime, int flags );
  761.  
  762. //
  763. // p_hud.c
  764. //
  765. void        MoveClientToIntermission        ( gentity_t *client );
  766. void        DeathmatchScoreboardMessage        ( gentity_t *client );
  767.  
  768. //
  769. // g_cmds.c
  770. //
  771.  
  772. //
  773. // g_main.c
  774. //
  775. void        FindIntermissionPoint                ( void );
  776. void        SetLeader                            ( int team, int client );
  777. void        G_RunThink                            ( gentity_t *ent );
  778. void QDECL    G_LogPrintf                            ( const char *fmt, ... );
  779. void        SendScoreboardMessageToAllClients    ( void );
  780. void        CheckGametype                        ( void );
  781.  
  782. //
  783. // g_client.c
  784. //
  785. char*        ClientConnect                        ( int clientNum, qboolean firstTime, qboolean isBot );
  786. void        ClientUserinfoChanged                ( int clientNum );
  787. void        ClientDisconnect                    ( int clientNum );
  788. void        ClientBegin                            ( int clientNum );
  789. void        ClientCommand                        ( int clientNum );
  790. gspawn_t*    G_SelectRandomSpawnPoint            ( team_t team );
  791. int            G_GametypeCommand                    ( int cmd, int arg0, int arg1, int arg2, int arg3, int arg4 );
  792.  
  793. //
  794. // g_active.c
  795. //
  796. void G_CheckClientTimeouts    ( gentity_t *ent );
  797. void G_CheckClientTeamkill    ( gentity_t *ent );
  798. void ClientThink            ( int clientNum );
  799. void ClientEndFrame            ( gentity_t *ent );
  800. void G_RunClient            ( gentity_t *ent );
  801.  
  802. //
  803. // g_team.c
  804. //
  805. qboolean OnSameTeam( gentity_t *ent1, gentity_t *ent2 );
  806. void Team_CheckDroppedItem( gentity_t *dropped );
  807.  
  808. //
  809. // g_session.c
  810. //
  811. void G_ReadSessionData( gclient_t *client );
  812. void G_InitSessionData( gclient_t *client, char *userinfo );
  813.  
  814. void G_InitWorldSession( void );
  815. void G_WriteSessionData( void );
  816.  
  817. //
  818. // g_bot.c
  819. //
  820. void G_InitBots( qboolean restart );
  821. char *G_GetBotInfoByNumber( int num );
  822. char *G_GetBotInfoByName( const char *name );
  823. void G_CheckBotSpawn( void );
  824. void G_RemoveQueuedBotBegin( int clientNum );
  825. qboolean G_BotConnect( int clientNum, qboolean restart );
  826. void Svcmd_AddBot_f( void );
  827. void Svcmd_BotList_f( void );
  828. void BotInterbreedEndMatch( void );
  829. qboolean G_DoesMapSupportGametype ( const char* gametype );
  830. void G_LoadArenas ( void );
  831.  
  832. //
  833. // g_gametype.c
  834. //
  835. gentity_t*    G_SelectGametypeSpawnPoint            ( team_t team, vec3_t origin, vec3_t angles );
  836. gentity_t*    G_SpawnGametypeItem                    ( const char* pickup_name, qboolean dropped, vec3_t origin );
  837. gentity_t*    G_SelectRandomGametypeSpawnPoint    ( team_t team );
  838. qboolean    G_ParseGametypeFile                    ( void );
  839. qboolean    G_ExecuteGametypeScript                ( gentity_t* activator, const char* name );
  840. void        G_ResetGametype                        ( void );
  841. qboolean    G_CanGametypeTriggerBeUsed            ( gentity_t* self, gentity_t* activator );
  842. void        G_ResetGametypeItem                    ( gitem_t* item );
  843. void        gametype_item_use                    ( gentity_t* self, gentity_t* other );
  844. void        G_DropGametypeItems                    ( gentity_t* self );
  845.  
  846. // ai_main.c
  847. #define MAX_FILEPATH            144
  848. int OrgVisible(vec3_t org1, vec3_t org2, int ignore);
  849.  
  850. //bot settings
  851. typedef struct bot_settings_s
  852. {
  853.     char personalityfile[MAX_FILEPATH];
  854.     float skill;
  855.     char team[MAX_FILEPATH];
  856. } bot_settings_t;
  857.  
  858. int BotAISetup( int restart );
  859. int BotAIShutdown( int restart );
  860. int BotAILoadMap( int restart );
  861. int BotAISetupClient(int client, struct bot_settings_s *settings, qboolean restart);
  862. int BotAIShutdownClient( int client, qboolean restart );
  863. int BotAIStartFrame( int time );
  864.  
  865. #include "g_team.h" // teamplay specific stuff
  866.  
  867.  
  868. extern    level_locals_t    level;
  869. extern    gentity_t        g_entities[MAX_GENTITIES];
  870.  
  871. #define    FOFS(x) ((int)&(((gentity_t *)0)->x))
  872.  
  873. extern    vmCvar_t    g_gametype;
  874. extern    vmCvar_t    g_dedicated;
  875. extern    vmCvar_t    g_cheats;
  876. extern    vmCvar_t    g_maxclients;            // allow this many total, including spectators
  877. extern    vmCvar_t    g_maxGameClients;        // allow this many active
  878. extern    vmCvar_t    g_restarted;
  879.  
  880. extern    vmCvar_t    g_logHits;
  881.  
  882. extern    vmCvar_t    g_dmflags;
  883. extern    vmCvar_t    g_scorelimit;
  884. extern    vmCvar_t    g_timelimit;
  885. extern    vmCvar_t    g_friendlyFire;
  886. extern    vmCvar_t    g_password;
  887. extern    vmCvar_t    g_needpass;
  888. extern    vmCvar_t    g_gravity;
  889. extern    vmCvar_t    g_speed;
  890. extern    vmCvar_t    g_knockback;
  891. extern    vmCvar_t    g_forcerespawn;
  892. extern    vmCvar_t    g_inactivity;
  893. extern    vmCvar_t    g_debugMove;
  894. extern    vmCvar_t    g_debugAlloc;
  895. extern    vmCvar_t    g_debugDamage;
  896. extern    vmCvar_t    g_weaponRespawn;
  897. extern    vmCvar_t    g_backpackRespawn;
  898. extern    vmCvar_t    g_synchronousClients;
  899. extern    vmCvar_t    g_motd;
  900. extern    vmCvar_t    g_warmup;
  901. extern    vmCvar_t    g_doWarmup;
  902. extern    vmCvar_t    g_allowVote;
  903. extern    vmCvar_t    g_voteDuration;
  904. extern    vmCvar_t    g_voteKickBanTime;
  905. extern    vmCvar_t    g_failedVoteDelay;
  906. extern    vmCvar_t    g_teamAutoJoin;
  907. extern    vmCvar_t    g_teamForceBalance;
  908. extern    vmCvar_t    g_smoothClients;
  909. extern    vmCvar_t    pmove_fixed;
  910. extern    vmCvar_t    pmove_msec;
  911. extern    vmCvar_t    g_rankings;
  912. extern    vmCvar_t    g_respawnInterval;
  913. extern    vmCvar_t    g_respawnInvulnerability;
  914. extern    vmCvar_t    RMG;
  915. extern  vmCvar_t    g_debugRMG;
  916. extern    vmCvar_t    g_timeouttospec;
  917. extern  vmCvar_t    g_roundtimelimit;
  918. extern  vmCvar_t    g_roundjointime;
  919. extern  vmCvar_t    g_timeextension;
  920. extern  vmCvar_t    g_roundstartdelay;
  921. extern  vmCvar_t    g_availableWeapons;
  922. extern    vmCvar_t    g_forceFollow;
  923. extern    vmCvar_t    g_followEnemy;
  924. extern  vmCvar_t    g_mapcycle;
  925. extern    vmCvar_t    g_pickupsDisabled;
  926. extern    vmCvar_t    g_suicidePenalty;
  927. extern    vmCvar_t    g_teamkillPenalty;
  928. extern    vmCvar_t    g_teamkillDamageMax;
  929. extern    vmCvar_t    g_teamkillDamageForgive;
  930. extern    vmCvar_t    g_teamkillBanTime;
  931. extern    vmCvar_t    g_voiceFloodCount;
  932. extern    vmCvar_t    g_voiceFloodPenalty;
  933. extern    vmCvar_t    g_voiceTalkingGhosts;
  934. extern    vmCvar_t    g_suddenDeath;
  935.  
  936. void    trap_Printf( const char *fmt );
  937. void    trap_Error( const char *fmt );
  938. int        trap_Milliseconds( void );
  939. int        trap_Argc( void );
  940. void    trap_Argv( int n, char *buffer, int bufferLength );
  941. void    trap_Args( char *buffer, int bufferLength );
  942. int        trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
  943. void    trap_FS_Read( void *buffer, int len, fileHandle_t f );
  944. void    trap_FS_Write( const void *buffer, int len, fileHandle_t f );
  945. void    trap_FS_FCloseFile( fileHandle_t f );
  946. int        trap_FS_GetFileList    ( const char *path, const char *extension, char *listbuf, int bufsize );
  947. void    trap_SendConsoleCommand( int exec_when, const char *text );
  948. void    trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags, float MinValue, float MaxValue );
  949. void    trap_Cvar_Update( vmCvar_t *cvar );
  950. void    trap_Cvar_Set( const char *var_name, const char *value );
  951. int        trap_Cvar_VariableIntegerValue( const char *var_name );
  952. float    trap_Cvar_VariableValue( const char *var_name );
  953. void    trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
  954. void    trap_LocateGameData( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, playerState_t *gameClients, int sizeofGameClient );
  955. void    trap_RMG_Init(int terrainID);
  956. void    trap_DropClient( int clientNum, const char *reason );
  957. void    trap_SendServerCommand( int clientNum, const char *text );
  958. void    trap_SetConfigstring( int num, const char *string );
  959. void    trap_GetConfigstring( int num, char *buffer, int bufferSize );
  960. void    trap_GetUserinfo( int num, char *buffer, int bufferSize );
  961. void    trap_SetUserinfo( int num, const char *buffer );
  962. void    trap_GetServerinfo( char *buffer, int bufferSize );
  963. void    trap_SetBrushModel( gentity_t *ent, const char *name );
  964. void    trap_SetActiveSubBSP(int index);
  965. void    trap_Trace( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask );
  966. int        trap_PointContents( const vec3_t point, int passEntityNum );
  967. qboolean trap_InPVS( const vec3_t p1, const vec3_t p2 );
  968. qboolean trap_InPVSIgnorePortals( const vec3_t p1, const vec3_t p2 );
  969. void    trap_AdjustAreaPortalState( gentity_t *ent, qboolean open );
  970. qboolean trap_AreasConnected( int area1, int area2 );
  971. void    trap_LinkEntity( gentity_t *ent );
  972. void    trap_UnlinkEntity( gentity_t *ent );
  973. int        trap_EntitiesInBox( const vec3_t mins, const vec3_t maxs, int *entityList, int maxcount );
  974. qboolean trap_EntityContact( const vec3_t mins, const vec3_t maxs, const gentity_t *ent );
  975. int        trap_BotAllocateClient( void );
  976. void    trap_BotFreeClient( int clientNum );
  977. void    trap_GetUsercmd( int clientNum, usercmd_t *cmd );
  978. qboolean    trap_GetEntityToken( char *buffer, int bufferSize );
  979. void        trap_GetWorldBounds ( vec3_t mins, vec3_t maxs );
  980.  
  981. void    *trap_BotGetMemoryGame(int size);
  982. void    trap_BotFreeMemoryGame(void *ptr);
  983.  
  984. int        trap_DebugPolygonCreate(int color, int numPoints, vec3_t *points);
  985. void    trap_DebugPolygonDelete(int id);
  986.  
  987. int        trap_BotLibSetup( void );
  988. int        trap_BotLibShutdown( void );
  989. int        trap_BotLibVarSet(char *var_name, char *value);
  990. int        trap_BotLibVarGet(char *var_name, char *value, int size);
  991. int        trap_BotLibDefine(char *string);
  992. int        trap_BotLibStartFrame(float time);
  993. int        trap_BotLibLoadMap(const char *mapname);
  994. int        trap_BotLibUpdateEntity(int ent, void /* struct bot_updateentity_s */ *bue);
  995. int        trap_BotLibTest(int parm0, char *parm1, vec3_t parm2, vec3_t parm3);
  996.  
  997. int        trap_BotGetSnapshotEntity( int clientNum, int sequence );
  998. int        trap_BotGetServerCommand(int clientNum, char *message, int size);
  999. void    trap_BotUserCommand(int client, usercmd_t *ucmd);
  1000.  
  1001. int        trap_AAS_BBoxAreas(vec3_t absmins, vec3_t absmaxs, int *areas, int maxareas);
  1002. int        trap_AAS_AreaInfo( int areanum, void /* struct aas_areainfo_s */ *info );
  1003. void    trap_AAS_EntityInfo(int entnum, void /* struct aas_entityinfo_s */ *info);
  1004.  
  1005. int        trap_AAS_Initialized(void);
  1006. void    trap_AAS_PresenceTypeBoundingBox(int presencetype, vec3_t mins, vec3_t maxs);
  1007. float    trap_AAS_Time(void);
  1008.  
  1009. int        trap_AAS_PointAreaNum(vec3_t point);
  1010. int        trap_AAS_PointReachabilityAreaIndex(vec3_t point);
  1011. int        trap_AAS_TraceAreas(vec3_t start, vec3_t end, int *areas, vec3_t *points, int maxareas);
  1012.  
  1013. int        trap_AAS_PointContents(vec3_t point);
  1014. int        trap_AAS_NextBSPEntity(int ent);
  1015. int        trap_AAS_ValueForBSPEpairKey(int ent, char *key, char *value, int size);
  1016. int        trap_AAS_VectorForBSPEpairKey(int ent, char *key, vec3_t v);
  1017. int        trap_AAS_FloatForBSPEpairKey(int ent, char *key, float *value);
  1018. int        trap_AAS_IntForBSPEpairKey(int ent, char *key, int *value);
  1019.  
  1020. int        trap_AAS_AreaReachability(int areanum);
  1021.  
  1022. int        trap_AAS_AreaTravelTimeToGoalArea(int areanum, vec3_t origin, int goalareanum, int travelflags);
  1023. int        trap_AAS_EnableRoutingArea( int areanum, int enable );
  1024. int        trap_AAS_PredictRoute(void /*struct aas_predictroute_s*/ *route, int areanum, vec3_t origin,
  1025.                             int goalareanum, int travelflags, int maxareas, int maxtime,
  1026.                             int stopevent, int stopcontents, int stoptfl, int stopareanum);
  1027.  
  1028. int        trap_AAS_AlternativeRouteGoals(vec3_t start, int startareanum, vec3_t goal, int goalareanum, int travelflags,
  1029.                                         void /*struct aas_altroutegoal_s*/ *altroutegoals, int maxaltroutegoals,
  1030.                                         int type);
  1031. int        trap_AAS_Swimming(vec3_t origin);
  1032. int        trap_AAS_PredictClientMovement(void /* aas_clientmove_s */ *move, int entnum, vec3_t origin, int presencetype, int onground, vec3_t velocity, vec3_t cmdmove, int cmdframes, int maxframes, float frametime, int stopevent, int stopareanum, int visualize);
  1033.  
  1034.  
  1035. void    trap_EA_Say(int client, char *str);
  1036. void    trap_EA_SayTeam(int client, char *str);
  1037. void    trap_EA_Command(int client, char *command);
  1038.  
  1039. void    trap_EA_Action(int client, int action);
  1040. void    trap_EA_Gesture(int client);
  1041. void    trap_EA_Talk(int client);
  1042. void    trap_EA_Attack(int client);
  1043. void    trap_EA_Use(int client);
  1044. void    trap_EA_Respawn(int client);
  1045. void    trap_EA_Crouch(int client);
  1046. void    trap_EA_MoveUp(int client);
  1047. void    trap_EA_MoveDown(int client);
  1048. void    trap_EA_MoveForward(int client);
  1049. void    trap_EA_MoveBack(int client);
  1050. void    trap_EA_MoveLeft(int client);
  1051. void    trap_EA_MoveRight(int client);
  1052. void    trap_EA_SelectWeapon(int client, int weapon);
  1053. void    trap_EA_Jump(int client);
  1054. void    trap_EA_DelayedJump(int client);
  1055. void    trap_EA_Move(int client, vec3_t dir, float speed);
  1056. void    trap_EA_View(int client, vec3_t viewangles);
  1057. void    trap_EA_Alt_Attack(int client);
  1058. void    trap_EA_ForcePower(int client);
  1059.  
  1060. void    trap_EA_EndRegular(int client, float thinktime);
  1061. void    trap_EA_GetInput(int client, float thinktime, void /* struct bot_input_s */ *input);
  1062. void    trap_EA_ResetInput(int client);
  1063.  
  1064.  
  1065. int        trap_BotLoadCharacter(char *charfile, float skill);
  1066. void    trap_BotFreeCharacter(int character);
  1067. float    trap_Characteristic_Float(int character, int index);
  1068. float    trap_Characteristic_BFloat(int character, int index, float min, float max);
  1069. int        trap_Characteristic_Integer(int character, int index);
  1070. int        trap_Characteristic_BInteger(int character, int index, int min, int max);
  1071. void    trap_Characteristic_String(int character, int index, char *buf, int size);
  1072.  
  1073. int        trap_BotAllocChatState(void);
  1074. void    trap_BotFreeChatState(int handle);
  1075. void    trap_BotQueueConsoleMessage(int chatstate, int type, char *message);
  1076. void    trap_BotRemoveConsoleMessage(int chatstate, int handle);
  1077. int        trap_BotNextConsoleMessage(int chatstate, void /* struct bot_consolemessage_s */ *cm);
  1078. int        trap_BotNumConsoleMessages(int chatstate);
  1079. void    trap_BotInitialChat(int chatstate, char *type, int mcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 );
  1080. int        trap_BotNumInitialChats(int chatstate, char *type);
  1081. int        trap_BotReplyChat(int chatstate, char *message, int mcontext, int vcontext, char *var0, char *var1, char *var2, char *var3, char *var4, char *var5, char *var6, char *var7 );
  1082. int        trap_BotChatLength(int chatstate);
  1083. void    trap_BotEnterChat(int chatstate, int client, int sendto);
  1084. void    trap_BotGetChatMessage(int chatstate, char *buf, int size);
  1085. int        trap_StringContains(char *str1, char *str2, int casesensitive);
  1086. int        trap_BotFindMatch(char *str, void /* struct bot_match_s */ *match, unsigned long int context);
  1087. void    trap_BotMatchVariable(void /* struct bot_match_s */ *match, int variable, char *buf, int size);
  1088. void    trap_UnifyWhiteSpaces(char *string);
  1089. void    trap_BotReplaceSynonyms(char *string, unsigned long int context);
  1090. int        trap_BotLoadChatFile(int chatstate, char *chatfile, char *chatname);
  1091. void    trap_BotSetChatGender(int chatstate, int gender);
  1092. void    trap_BotSetChatName(int chatstate, char *name, int client);
  1093. void    trap_BotResetGoalState(int goalstate);
  1094. void    trap_BotRemoveFromAvoidGoals(int goalstate, int number);
  1095. void    trap_BotResetAvoidGoals(int goalstate);
  1096. void    trap_BotPushGoal(int goalstate, void /* struct bot_goal_s */ *goal);
  1097. void    trap_BotPopGoal(int goalstate);
  1098. void    trap_BotEmptyGoalStack(int goalstate);
  1099. void    trap_BotDumpAvoidGoals(int goalstate);
  1100. void    trap_BotDumpGoalStack(int goalstate);
  1101. void    trap_BotGoalName(int number, char *name, int size);
  1102. int        trap_BotGetTopGoal(int goalstate, void /* struct bot_goal_s */ *goal);
  1103. int        trap_BotGetSecondGoal(int goalstate, void /* struct bot_goal_s */ *goal);
  1104. int        trap_BotChooseLTGItem(int goalstate, vec3_t origin, int *inventory, int travelflags);
  1105. int        trap_BotChooseNBGItem(int goalstate, vec3_t origin, int *inventory, int travelflags, void /* struct bot_goal_s */ *ltg, float maxtime);
  1106. int        trap_BotTouchingGoal(vec3_t origin, void /* struct bot_goal_s */ *goal);
  1107. int        trap_BotItemGoalInVisButNotVisible(int viewer, vec3_t eye, vec3_t viewangles, void /* struct bot_goal_s */ *goal);
  1108. int        trap_BotGetNextCampSpotGoal(int num, void /* struct bot_goal_s */ *goal);
  1109. int        trap_BotGetMapLocationGoal(char *name, void /* struct bot_goal_s */ *goal);
  1110. int        trap_BotGetLevelItemGoal(int index, char *classname, void /* struct bot_goal_s */ *goal);
  1111. float    trap_BotAvoidGoalTime(int goalstate, int number);
  1112. void    trap_BotSetAvoidGoalTime(int goalstate, int number, float avoidtime);
  1113. void    trap_BotInitLevelItems(void);
  1114. void    trap_BotUpdateEntityItems(void);
  1115. int        trap_BotLoadItemWeights(int goalstate, char *filename);
  1116. void    trap_BotFreeItemWeights(int goalstate);
  1117. void    trap_BotInterbreedGoalFuzzyLogic(int parent1, int parent2, int child);
  1118. void    trap_BotSaveGoalFuzzyLogic(int goalstate, char *filename);
  1119. void    trap_BotMutateGoalFuzzyLogic(int goalstate, float range);
  1120. int        trap_BotAllocGoalState(int state);
  1121. void    trap_BotFreeGoalState(int handle);
  1122.  
  1123. void    trap_BotResetMoveState(int movestate);
  1124. void    trap_BotMoveToGoal(void /* struct bot_moveresult_s */ *result, int movestate, void /* struct bot_goal_s */ *goal, int travelflags);
  1125. int        trap_BotMoveInDirection(int movestate, vec3_t dir, float speed, int type);
  1126. void    trap_BotResetAvoidReach(int movestate);
  1127. void    trap_BotResetLastAvoidReach(int movestate);
  1128. int        trap_BotReachabilityArea(vec3_t origin, int testground);
  1129. int        trap_BotMovementViewTarget(int movestate, void /* struct bot_goal_s */ *goal, int travelflags, float lookahead, vec3_t target);
  1130. int        trap_BotPredictVisiblePosition(vec3_t origin, int areanum, void /* struct bot_goal_s */ *goal, int travelflags, vec3_t target);
  1131. int        trap_BotAllocMoveState(void);
  1132. void    trap_BotFreeMoveState(int handle);
  1133. void    trap_BotInitMoveState(int handle, void /* struct bot_initmove_s */ *initmove);
  1134. void    trap_BotAddAvoidSpot(int movestate, vec3_t origin, float radius, int type);
  1135.  
  1136. int        trap_BotChooseBestFightWeapon(int weaponstate, int *inventory);
  1137. void    trap_BotGetWeaponInfo(int weaponstate, int weapon, void /* struct weaponinfo_s */ *weaponinfo);
  1138. int        trap_BotLoadWeaponWeights(int weaponstate, char *filename);
  1139. int        trap_BotAllocWeaponState(void);
  1140. void    trap_BotFreeWeaponState(int weaponstate);
  1141. void    trap_BotResetWeaponState(int weaponstate);
  1142.  
  1143. int        trap_GeneticParentsAndChildSelection(int numranks, float *ranks, int *parent1, int *parent2, int *child);
  1144.  
  1145. void    trap_SnapVector( float *v );
  1146.  
  1147. int            trap_CM_RegisterTerrain(const char *config);
  1148.  
  1149. void        *trap_VM_LocalAlloc ( int size );
  1150. void        *trap_VM_LocalAllocUnaligned ( int size );            // WARNING!!!! USE WITH CAUTION!!! BEWARE OF DOG!!!
  1151. void        *trap_VM_LocalTempAlloc( int size );
  1152. void        trap_VM_LocalTempFree( int size );                    // free must be in opposite order of allocation!
  1153. const char    *trap_VM_LocalStringAlloc ( const char *source );
  1154.  
  1155. // Gametype traps
  1156. void        trap_GT_Init        ( const char* gametype, qboolean restart );
  1157. void        trap_GT_RunFrame    ( int time );
  1158. void        trap_GT_Start        ( int time );
  1159. int            trap_GT_SendEvent    ( int event, int time, int arg0, int arg1, int arg2, int arg3, int arg4 );
  1160.  
  1161. void G_UpdateClientAntiLag    ( gentity_t* ent );
  1162. void G_UndoAntiLag            ( void );
  1163. void G_ApplyAntiLag            ( gentity_t* ref, qboolean enlargeHitBox );
  1164.  
  1165.